<html>
<head><meta charset="utf-8"><title>FCP for wasm simd? · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html">FCP for wasm simd?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="237502999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237502999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237502999">(May 05 2021 at 14:22)</a>:</h4>
<p>I wanted to poke here about <a href="https://github.com/rust-lang/rust/issues/74372">https://github.com/rust-lang/rust/issues/74372</a>, could I convince a libs team member to kick off an FCP for me? Or, failing that, get some feedback on what should happen before that happens?</p>



<a name="237517315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517315">(May 05 2021 at 15:38)</a>:</h4>
<p>So, a couple of thoughts:</p>



<a name="237517509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517509">(May 05 2021 at 15:40)</a>:</h4>
<p>Making an unsafe function safe is not necessarily a non-breaking change. It breaks any code that wraps a call with unsafe, because we'll complain about the unnecessary unsafe. I think that may be permitted breakage, but it might be rather disruptive.</p>



<a name="237517631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517631">(May 05 2021 at 15:40)</a>:</h4>
<p>So at the very least I think we should gate stabilization on either deciding we're prepared to live with that or fixing whatever stops us from making them safe.</p>



<a name="237517723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517723">(May 05 2021 at 15:41)</a>:</h4>
<p>We don't consider changes that would trigger lints to be breaks</p>



<a name="237517746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517746">(May 05 2021 at 15:41)</a>:</h4>
<p>particularly since cargo will force-suppress them in dependencies</p>



<a name="237517885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517885">(May 05 2021 at 15:42)</a>:</h4>
<p>I need to look through the issue again, but I think my biggest concern would be whether or not we are going to align with clang (or if clang is going to align with us I guess)</p>



<a name="237517903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237517903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237517903">(May 05 2021 at 15:42)</a>:</h4>
<p>I realize that. But if they're used widely, it would still be disruptive, even if it's something we accept. My point was not that this is a blocker, it's just a point I'd like to carefully consider before we stabilize.</p>



<a name="237518137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518137">(May 05 2021 at 15:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> Out of curiosity, does WebAssembly have any mechanism for runtime detection of feature availability?</p>



<a name="237518205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518205">(May 05 2021 at 15:44)</a>:</h4>
<p>Given the way validation works, I'm wondering how that might be possible.</p>



<a name="237518506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518506">(May 05 2021 at 15:46)</a>:</h4>
<p>Currently, no, there's no equivalent to runtime feature detection.</p>
<p>As for matching clang, personally I think Rust should decide "no". At this point clang is a moving target and I'm not sure when it'll stop moving. I'm not under the impression that the folks working on clang are eye-ing the header with the same stability guarantees we'd like to apply. I also don't think C has anywhere near the established precedent it had for x86. Combined with how wasm intrinsics are pretty small (~200) I would say that we should review the intrinsics as appropriate for Rust rather than matching C</p>



<a name="237518803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518803">(May 05 2021 at 15:48)</a>:</h4>
<p>It sounds like you're already matching clang reasonably closely, and all the divergences you mentioned seem appropriate for Rust.</p>



<a name="237518861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518861">(May 05 2021 at 15:48)</a>:</h4>
<p>Things like using types rather than having distinct intrinsics for _u and _s.</p>



<a name="237518877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237518877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237518877">(May 05 2021 at 15:49)</a>:</h4>
<p>Yeah I don't think we should <em>ignore</em> clang by any means, but I don't think there's the same story for x86 where we need to strictly match clang in all regards</p>



<a name="237519668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237519668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237519668">(May 05 2021 at 15:54)</a>:</h4>
<p>So, what precisely would we need in order to make the intrinsics safe? It sounds like we have two options there:<br>
Either we just drop the target feature attribute and don't guarantee that the intrinsic actually generates the expected instructions unless you supply that target feature at compile time...<br>
or alternatively, we do always generate the expected instructions and we need to do some careful review and potentially some fixing on the interplay between target feature and inlining.</p>



<a name="237519787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237519787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237519787">(May 05 2021 at 15:55)</a>:</h4>
<p>Safety I think only requires relaxing the '<code>#[target_feature]</code> requries an <code>unsafe fn</code>" requirement on webassembly targets</p>



<a name="237519885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237519885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237519885">(May 05 2021 at 15:55)</a>:</h4>
<p>Currently the target feature attribute is required in one form or another to properly codegen all the intrinsics</p>



<a name="237519920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237519920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237519920">(May 05 2021 at 15:55)</a>:</h4>
<p>Either way it's still safe because the WASM runtime will refuse to load a module with unsupported instructions. Unlike real architectures where unsupported instructions are effectively UB.</p>



<a name="237519931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237519931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237519931">(May 05 2021 at 15:56)</a>:</h4>
<p>correct, yeah</p>



<a name="237520038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520038">(May 05 2021 at 15:56)</a>:</h4>
<p>I can implement this in rustc if it's seen as a blocker</p>



<a name="237520206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520206">(May 05 2021 at 15:57)</a>:</h4>
<p>It's not necessarily a blocker, I just wanted to understand the spectrum of options.</p>



<a name="237520234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520234">(May 05 2021 at 15:57)</a>:</h4>
<p>I personally would consider it a blocker for stabilization, but not a blocker for adding it to nightly.</p>



<a name="237520348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520348">(May 05 2021 at 15:58)</a>:</h4>
<p>Does that seem reasonable?</p>



<a name="237520510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520510">(May 05 2021 at 15:59)</a>:</h4>
<p>Assuming the compiler/language teams are on board with this I'm ok blocking this on that, I just don't want to get caught up in all this too much.</p>



<a name="237520555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520555">(May 05 2021 at 15:59)</a>:</h4>
<p>Everything fwiw is "implemented" on nightly but hasn't landed in rust-lang/rust yet for other reasons (the switch from <code>rustc_args_required_const</code>)</p>



<a name="237520715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237520715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237520715">(May 05 2021 at 16:00)</a>:</h4>
<p>I'm eager in any case to keep the ball rolling on these intrinsics, I want to make sure that Rust doesn't accidentally fall behind in support for wasm</p>



<a name="237521067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521067">(May 05 2021 at 16:02)</a>:</h4>
<p>With my language hat on, I'm on board with dropping the requirement for unsafe for target features on wasm.</p>



<a name="237521106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521106">(May 05 2021 at 16:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> have you checked in at all with the portable-simd project group on whether they have any opinions on how these intrinsics look and such? Even though for x86 we sort of have to use what's there it'd be good to make sure we don't create more pain on the wasm end I think before stabilizing</p>



<a name="237521212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521212">(May 05 2021 at 16:03)</a>:</h4>
<p>I have not, no. But again I'm sort of wary piling on so many requirements....</p>



<a name="237521226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521226">(May 05 2021 at 16:03)</a>:</h4>
<p>is portable simd anywhere close to stabilization in Rust?</p>



<a name="237521243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521243">(May 05 2021 at 16:03)</a>:</h4>
<p>(I'm also not sure why portable simd would use the wasm intrinsics at all)</p>



<a name="237521330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521330">(May 05 2021 at 16:04)</a>:</h4>
<p>it would need to use them under the hood, just like the x86 intrinsics, right? Maybe I'm completely wrong here</p>



<a name="237521426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521426">(May 05 2021 at 16:04)</a>:</h4>
<p>I am not following the design but I would imagine they would use raw LLVM bits and pieces rather than the actual intrinsics</p>



<a name="237521431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521431">(May 05 2021 at 16:04)</a>:</h4>
<p>Also, there is an active discussion going on about whether we want the intrinsics for new architectures to use const generics syntax or a const-generics-arg-in-argument-position the way current x86 intrinsics do.</p>



<a name="237521448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521448">(May 05 2021 at 16:04)</a>:</h4>
<p>if they can be built on intrinsics alone there's no reason to be in libstd</p>



<a name="237521482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521482">(May 05 2021 at 16:05)</a>:</h4>
<p>everything in simd uses const generics</p>



<a name="237521493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521493">(May 05 2021 at 16:05)</a>:</h4>
<p>er, in wasm</p>



<a name="237521509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521509">(May 05 2021 at 16:05)</a>:</h4>
<p>nothing uses <code>rustc_args_required_const</code></p>



<a name="237521578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521578">(May 05 2021 at 16:05)</a>:</h4>
<p>I'm not talking about <code>rustc_args_required_const</code>.</p>



<a name="237521683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521683">(May 05 2021 at 16:06)</a>:</h4>
<p>hm I'm not sure how this applies then?</p>



<a name="237521694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521694">(May 05 2021 at 16:06)</a>:</h4>
<p>or what it's referring to?</p>



<a name="237521830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237521830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237521830">(May 05 2021 at 16:06)</a>:</h4>
<p>Trying to find the current attribute name...</p>



<a name="237522216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237522216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237522216">(May 05 2021 at 16:08)</a>:</h4>
<p>do you mean <code>rustc_legacy_const_generics</code>? because that's just a workaround for things that used to be <code>rustc_args_required_const</code>, right?</p>



<a name="237522467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237522467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237522467">(May 05 2021 at 16:09)</a>:</h4>
<p>That's the one, thank you. There was discussion going on within lang about whether, since we need to keep supporting that on x86, we should consider making that a general mechanism that other architectures should use as well, and generalize the concept of passing a const generics parameter in argument position.</p>



<a name="237522470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237522470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BurntSushi <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237522470">(May 05 2021 at 16:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F/near/237517509">said</a>:</p>
<blockquote>
<p>Making an unsafe function safe is not necessarily a non-breaking change. It breaks any code that wraps a call with unsafe, because we'll complain about the unnecessary unsafe. I think that may be permitted breakage, but it might be rather disruptive.</p>
</blockquote>
<p>FWIW, this is the reasoning under which we stabilized existing vendor intrinsics for x86. at the time, we knew that we might some day be able to devise a smarter <code>target_feature</code> system that didn't require as much <code>unsafe</code> usage. that is, we have never historically considered this something that breaks code.</p>
<p>i agree it's worth keeping in mind as something that's possibly disruptive, but i think the historical context of related past decisions is useful to note.</p>



<a name="237522827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237522827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237522827">(May 05 2021 at 16:12)</a>:</h4>
<p>wrt <code>rustc_legacy_const_generics</code> I think the APIs as-is in the <code>simd128</code> module would want to be reviewed, if the const-generic syntax seems too clunky to change then that would motivate switching to <code>rustc_legacy_const_generics</code> or something like that</p>



<a name="237523445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237523445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237523445">(May 05 2021 at 16:16)</a>:</h4>
<p>To say my point another way, though, I basically don't know how to move these forward in Rust. No one seems willing to commit Rust to supporting these intrinsics on stable in that they're willing to put their backing behind this. There's lots of opinions about how little things can be tweaked here and there, but no one's really considering this from the point of view of "is this really ready yet?". I'm personally advocating for getting to that point and want to get there, but I think I need someone to agree that "now's the time to stabilize this" and the little things just all need to get out of the way before that happens</p>



<a name="237523599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237523599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237523599">(May 05 2021 at 16:17)</a>:</h4>
<p>In that I'm happy to implement suggestions as they come up and help out with reviews, but I don't want this feature to be "alex perpetually implements whatever someone thinks might be nice and it never ends up actually getting stabilized"</p>



<a name="237523782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237523782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237523782">(May 05 2021 at 16:18)</a>:</h4>
<p>So, I should have led with this: I had some questions, but I'm definitely interested in supporting these.</p>



<a name="237524100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524100">(May 05 2021 at 16:20)</a>:</h4>
<p>I think it would be entirely appropriate to go ahead and merge them into nightly. Things like adding the attribute that allows passing a const argument in argument position as an alternative to const generics syntax is something we can do <em>on</em> nightly. It doesn't need to be a blocker for adding this to nightly.</p>



<a name="237524140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524140">(May 05 2021 at 16:20)</a>:</h4>
<p>Likewise for doing the work to make these safe.</p>



<a name="237524424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524424">(May 05 2021 at 16:22)</a>:</h4>
<p>So far this discussion has raised:</p>
<ul>
<li>Make <code>#[target_feature]</code> safe on wasm - I can do this and agree with it</li>
<li>Naming - no real conclusion here, I don't get the impression anyone wants to consider names in Rust and we'd prefer to inherit from C, but I'm trying to make a case that this doesn't make sense for Rust. This needs input from others, though, in that I can't just go off and do something to resolve this.</li>
<li>Compatibility with portable simd - I seemingly need to go learn about the design of portable simd and make sure it works with wasm... somehow? I don't really have the motivation for this myself, but I'm not sure if this is a blocker?</li>
<li>Syntax/APIs - this requires some review from folks I think, I assert that the current APIs are pretty good to work with, and it can't really be on me to review this.</li>
</ul>



<a name="237524504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524504">(May 05 2021 at 16:23)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> to be clear this is all ready to go in nightly, but stdarch is stuck and can't get updated for reasons that I'm not currently following</p>



<a name="237524526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524526">(May 05 2021 at 16:23)</a>:</h4>
<p>I'm assuming those reasons will get resolved at some point, but I do not know when</p>



<a name="237524571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524571">(May 05 2021 at 16:23)</a>:</h4>
<p>otherwise there's nothing I can do without trying to accelerate those reasons</p>



<a name="237524691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237524691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237524691">(May 05 2021 at 16:24)</a>:</h4>
<p>I only just now realized that these are already present on nightly; I misread the issue you linked to because the opening post of the issue talks about adding them, but the last post is about stabilizing.</p>



<a name="237525158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525158">(May 05 2021 at 16:27)</a>:</h4>
<p>There are intrinsics in the <code>wasm32</code> module but they're "wrong" in that they're a version from ~3 months ago</p>



<a name="237525177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525177">(May 05 2021 at 16:28)</a>:</h4>
<p>Ah. So, they do need updating before we can consider stabilization?</p>



<a name="237525220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525220">(May 05 2021 at 16:28)</a>:</h4>
<p>lots has changed since then and I'm not proposing stabilizing those intrinsics</p>



<a name="237525232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525232">(May 05 2021 at 16:28)</a>:</h4>
<p>indeed (mentioned in the comment)</p>



<a name="237525234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525234">(May 05 2021 at 16:28)</a>:</h4>
<p>Got it.</p>



<a name="237525406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525406">(May 05 2021 at 16:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116015">Alex Crichton</span> <a href="#narrow/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F/near/237524424">said</a>:</p>
<blockquote>
<p>So far this discussion has raised:</p>
</blockquote>
<p>Of those:</p>
<ul>
<li>I do think if it's straightforward to make <code>#[target_feature]</code> safe on wasm we should. If it turns out to be incredibly difficult, we can re-assess once we know that.</li>
<li>I think the naming you're proposing is well-justified, and if someone wants the names to be different they can raise a concern in the FCP. Let's avoid anticipatory bikeshedding.</li>
<li>Regarding the portable SIMD effort, that'd be a consumer of this at most, and I don't think there's any degree to which it needs to block stabilization. These intrinsics match the underlying wasm instructions, or build slightly upon them for type-friendliness; their structure is pretty much determined by wasm.</li>
<li>Regarding syntax, thinking about it, I think it'd be fine to stabilize the current syntax as-is, and that doesn't <em>stop</em> us from adding a potentially friendlier syntax for the const generic arguments <em>later</em>.</li>
</ul>



<a name="237525628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525628">(May 05 2021 at 16:30)</a>:</h4>
<p>Which just leaves the issue of updating stdarch. Does that sound about right?</p>



<a name="237525777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525777">(May 05 2021 at 16:31)</a>:</h4>
<p>I'm ok with all that yeah. I was hoping to ideally start FCP before stdarch is updated but if that is desired first then I'm also ok with that, I would just want to go investigate more what's blocking the update and what the expected update schedule is</p>



<a name="237525901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237525901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237525901">(May 05 2021 at 16:32)</a>:</h4>
<p>I'd be fine with starting an FCP and filing "update stdarch" and "make target_feature safe on wasm" concerns, and then we can start collecting consensus.</p>



<a name="237526051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237526051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237526051">(May 05 2021 at 16:33)</a>:</h4>
<p>that sounds good to me, I'm happy to discuss at any length everything here, I just want to make sure that there's concrete stuff to do at the end of discussion</p>



<a name="237526081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237526081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237526081">(May 05 2021 at 16:33)</a>:</h4>
<p>I completely understand that. Next steps are important. :)</p>



<a name="237526466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237526466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237526466">(May 05 2021 at 16:36)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/74372#issuecomment-832838289">https://github.com/rust-lang/rust/issues/74372#issuecomment-832838289</a></p>



<a name="237526504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237526504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237526504">(May 05 2021 at 16:36)</a>:</h4>
<p>thanks!</p>



<a name="237526533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237526533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237526533">(May 05 2021 at 16:37)</a>:</h4>
<p>Thanks for working on this!</p>



<a name="237532274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237532274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237532274">(May 05 2021 at 17:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F/near/237521330">said</a>:</p>
<blockquote>
<p>it would need to use them under the hood, just like the x86 intrinsics, right? Maybe I'm completely wrong here</p>
</blockquote>
<p>No, portable simd doesn't use any architecture specific intrinsics under the hood. Instead everything uses <code>extern "platform-intrinsics"</code> which are architecture independent intrinsics like <code>simd_add</code> capable of handling pretty much arbitrary vector and lane sizes.</p>



<a name="237598855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237598855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237598855">(May 06 2021 at 03:12)</a>:</h4>
<p>Confirming that, yeah. We are paying close attention to make sure that the codegen is as correct as possible, and we may need to revise some of the internal Rust compiler APIs for that purpose, but it's purely an internal thing. We do not use arch-specific intrinsics, indeed we are going rather out of our way to avoid doing so.</p>



<a name="237602371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/237602371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#237602371">(May 06 2021 at 04:06)</a>:</h4>
<p>I could possibly fabricate a concern about the <code>#[target_feature]</code> stuff, but only because that's slightly beyond a purely libs-level concern, and then it would just be as another possible user of it, in essence. Stabilizing an intrinsic never needs to block on or even worry about us. And I sure can't think of anything right now about <code>#[target_feature]</code>, so!</p>



<a name="238041973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238041973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238041973">(May 09 2021 at 15:12)</a>:</h4>
<p>I think it is valuable to retain <code>simd128</code> feature name just for consistency with the other targets that don't namespace the features. They should usually already be "namespaced" by the target cfg too.</p>



<a name="238042044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238042044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238042044">(May 09 2021 at 15:13)</a>:</h4>
<p>It'd seem quite awkward to me to have to repeat yourself that, yes you do indeed mean the wasm-simd128 feature rather than, say, similarly named one for another feature when the line above already says <code>#[cfg(target_family="wasm")]</code>, or it appears in a file named <code>wasm.rs</code> (that is then cfg'd similarly) or similar.</p>



<a name="238061177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238061177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BurntSushi <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238061177">(May 09 2021 at 20:57)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I'm sorry, i believe i agree. I don't think i realized target feature names were already namespaced. If that's true, then i agree the stutter isn't worth it.</p>
<p>To be clear, if we go with simd128 and another target happens to want to use that name too, would that be okay? (I suppose this is a good test for how strong the namespacing is.)</p>
<p>I think i am mostly just ignorant here and it is very possible that my suggestion to use wasm-simd128 is in poor taste.</p>



<a name="238061593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238061593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238061593">(May 09 2021 at 21:03)</a>:</h4>
<p>Yeah, there wouldn't be anything preventing another target from using the same feature name. The only concern in that situation is what <span class="user-mention" data-user-id="281757">@Jubilee</span> mentioned – users reading code couldn't necessarily tell immediately if, say, <code>#[target_feature(enable="simd128")]</code> is enabling a feature for wasm or some other target that has such a feature. In order to understand this some context is necessary (e.g. what <code>cfg</code>s gate the code in question).</p>



<a name="238061812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238061812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238061812">(May 09 2021 at 21:06)</a>:</h4>
<p>But that sounds more like an issue with <code>cfg</code>s to me (and it is an issue, its pretty hard to tell sometimes when is a piece of code is being enabled)</p>



<a name="238062430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238062430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238062430">(May 09 2021 at 21:16)</a>:</h4>
<p>t b h, I don't really have much of a dog in this fight, but I believe a unique exception is plausibly justified by wasm being a sort of "layered assembly". It's not <em>hugely</em> different from other targets... but it's not actually all that like other targets, either, which is already being used as a reason to handle its <code>target_feature</code> cases specially.</p>



<a name="238062567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238062567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238062567">(May 09 2021 at 21:19)</a>:</h4>
<p>And in that sense I also don't think whatever judgement is arrived at is really precedent for anything else that isn't trying to be like wasm either (i.e. a hypergeneric kind of assembly). People aren't exactly going to be in situations where the "mixed targets + overgeneric terms in one project" problem comes up for anything else nearly enough.</p>



<a name="238121184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238121184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BurntSushi <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238121184">(May 10 2021 at 10:58)</a>:</h4>
<p>yeah those are good points. maybe the real problem here is that it <em>feels</em> like target feature names aren't namespaced, for exactly the reasons you state: when you use them, it's often not locally clear that they are actually within a namespace. so this kind of feels like a bigger problem than WASM to me, and maybe the super generic name of <code>simd128</code> has just kind of poked at it a bit.</p>
<p>personally, i'm fine with just using <code>simd128</code> i think, since the namespace <em>does</em> exist.</p>



<a name="238203685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/238203685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#238203685">(May 10 2021 at 20:07)</a>:</h4>
<p>Alright~ From my perspective, I think my biggest actual concern was what actually already got fixed: any difference between the feature name in the <strong>CLI</strong> and in the code. I really don't want to have to explain that to anyone, and I'm glad I don't anymore. :^)</p>
<p>Given that, I'm pretty OK with using the <code>simd128</code> name for enabling Wasm SIMD, if people</p>
<ol start="0">
<li>don't think the diagnostic/legibility concerns are big (or that this will meaningfully constrain alternative solutions for solving those concerns)</li>
<li>and as long as we don't want to, for instance, later reuse the simd128 name ourselves for a hypothetical "target-neutral feature level" or anything, which would e.g. enable Altivec, SSE2, Neon, Wasm SIMD, and RISCV-V with an assumption that at least 128 bit vector registers are available...)</li>
<li>are happy with it, obviously~</li>
</ol>
<p>2 obviously seems to be satisfied, 0 seems to be the emerging consensus, leaning towards 0b of "this is a problem but we should probably fix it some other way", and 1 is basically the only remaining possible angle I could think of where this would be a concern. :^) And is... admittedly out there.</p>



<a name="239659487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239659487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239659487">(May 20 2021 at 21:07)</a>:</h4>
<p>oh <span class="user-mention" data-user-id="239881">@Josh Triplett</span> mind resolving the update-stdarch concern here -- <a href="https://github.com/rust-lang/rust/issues/74372#issuecomment-832838296">https://github.com/rust-lang/rust/issues/74372#issuecomment-832838296</a>?</p>



<a name="239663432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239663432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239663432">(May 20 2021 at 21:38)</a>:</h4>
<p>Can you give me a link to where stdarch was updated to match the proposal, so I can link to that when resolving the concern?</p>



<a name="239664354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239664354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239664354">(May 20 2021 at 21:46)</a>:</h4>
<p>sure yeah, I commented in <a href="https://github.com/rust-lang/rust/issues/74372#issuecomment-835696632">https://github.com/rust-lang/rust/issues/74372#issuecomment-835696632</a>, the PR was <a href="https://github.com/rust-lang/rust/pull/83278">https://github.com/rust-lang/rust/pull/83278</a>, and the docs are at <a href="https://doc.rust-lang.org/nightly/core/arch/wasm32/">https://doc.rust-lang.org/nightly/core/arch/wasm32/</a></p>



<a name="239665853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239665853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239665853">(May 20 2021 at 22:00)</a>:</h4>
<p>Perfect, thanks. I'll link to your comment.</p>



<a name="239665907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239665907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239665907">(May 20 2021 at 22:00)</a>:</h4>
<p>And we're in FCP. :)</p>



<a name="239666931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239666931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239666931">(May 20 2021 at 22:10)</a>:</h4>
<p>thanks!</p>



<a name="239667637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/FCP%20for%20wasm%20simd%3F/near/239667637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/FCP.20for.20wasm.20simd.3F.html#239667637">(May 20 2021 at 22:18)</a>:</h4>
<p>I've <a href="https://github.com/WebAssembly/simd/issues/480#issuecomment-845517158">left a comment</a> on the wasm simd proposal's tracking issue to help raise visibility here as well in case anyone's watching that but not Rust specifically</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>